package com.scs.application.modules.order.dto;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Future;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Past;
import java.io.Serializable;
import java.util.Date;

/**
 * @Description:发货单导入实体对象
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ToString(callSuper = true)
@Accessors(chain = true)
public class DeliveryItemImportDTO implements Serializable {
    /** 商品名称 */
    @Excel(name = "商品名称", width = 65)
    @NotBlank(message="商品名称不能为空")
    @Length(min=1, max=100, message="商品名称长度必须介于 1 和 100 之间")
    private String materialName;

    /** 规格 */
    @Excel(name = "规格", width = 18)
    @Length(min=1, max=100, message="规格长度必须介于 1 和 100 之间")
    private String materialSpec;

    /**发货单位*/
    @Excel(name = "发货单位", width = 18)
    private String orderUnit;


    /** 本次实发 */
    @Excel(name = "发货数量")
    @DecimalMin(value = "0.0")
    private Integer deliveryNumber;

    /** 小计(元) */
    @Excel(name = "小计(元)")
    private Double subtotalAmount;

    /** 批次 */
    @Excel(name = "批次")
    private String lot;

    /** 生产日期 */
    @Excel(name = "生产日期", format = "yyyyMMdd", width = 11)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format = "yyyy-MM-dd")
    @Past(message = "生产日期不能晚于当前时间")
    private Date productionDate;

    /** 有效日期 */
    @Excel(name = "过期日期", format = "yyyyMMdd", width = 11)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format = "yyyy-MM-dd")
    @Future(message = "过期日期不能早于当前时间")
    private Date  expiredDate;

    /** 灭菌日期 */
    @Excel(name = "灭菌日期", format = "yyyyMMdd", width = 11)
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format = "yyyy-MM-dd")
    private Date sterilizationDate;
}
